<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="D1"></div>
    <!-- <a href="prev.html">上一页</a>
    <a href="next.html">下一页</a> -->
    <button id="btn">显示</button>
    <button id="btn2">刷新</button>

    <script>
        var str='你好'

        document.getElementById('btn').onclick=function(){
            document.getElementById('D1').innerHTML=location.href
        }
        document.getElementById('btn2').onclick=function(){
            location.reload()
        }

        // try {
        //     console.log(str2)
        // } catch (error) {
        //     console.log(error.message)
        // }
        
        setTimeout(function () {
            console.log(str2)
        },3000)

        console.log(str)
    </script>
</body>
</html>